/*
 * @Author: linZeJian
 * @Date: 2022-04-28 10:20:31
 * @LastEditors: linZeJian
 * @LastEditTime: 2022-04-29 09:44:10
 * @Description: 
 */

import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import "@/assets/css/global.css"
import "@/assets/css/element.scss"

import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);

Vue.config.productionTip = false;

//初始化操作加载
import './permission.js'
import { isMobile } from "@/utils/methods";
store.state.isMobileState = isMobile()

Vue.prototype.$back = () => {
  window.history.back()
}

import { isInIcestark, setLibraryName } from '@ice/stark-app';
setLibraryName('icestark-app-element');

let vue

export function mount(props) {
  const { container } = props;
  vue = new Vue({
    router,
    store,
    mounted: () => {
    },
    destroyed: () => {
    },
    render: h => h(App),
  }).$mount();

  // for vue don't replace mountNode
  container.innerHTML = '';
  container.appendChild(vue.$el);
}

export function unmount() {
  if (vue) vue.$destroy();
  vue.$el.innerHTML = '';
  vue = null;
}


if(!isInIcestark()){
  new Vue({
    router,
    store,
    render: h => h(App)
  }).$mount('#app')
}

